package com.song.util.excel;

import org.apache.poi.ss.usermodel.*;

public class PoiUtil {
    public static CellStyle titleStyle(Workbook workbook){
        CellStyle titleStyle = workbook.createCellStyle();
        titleStyle.setVerticalAlignment(VerticalAlignment.CENTER);
        titleStyle.setAlignment(HorizontalAlignment.CENTER);
        titleStyle.setWrapText(true);
        titleStyle.setBorderTop(BorderStyle.THIN);
        titleStyle.setBorderRight(BorderStyle.THIN);
        titleStyle.setBorderLeft(BorderStyle.THIN);
        titleStyle.setBorderBottom(BorderStyle.THIN);
        Font font = workbook.createFont();
        font.setItalic(false);
        font.setBold(true);
        titleStyle.setFont(font);
        return titleStyle;
    }

    public static CellStyle secondTitleStyle(Workbook workbook){
        CellStyle secondTitleStyle = workbook.createCellStyle();
        secondTitleStyle.setVerticalAlignment(VerticalAlignment.CENTER);
        secondTitleStyle.setAlignment(HorizontalAlignment.RIGHT);
        secondTitleStyle.setWrapText(true);
        secondTitleStyle.setBorderTop(BorderStyle.THIN);
        secondTitleStyle.setBorderRight(BorderStyle.THIN);
        secondTitleStyle.setBorderLeft(BorderStyle.THIN);
        secondTitleStyle.setBorderBottom(BorderStyle.THIN);
        Font font = workbook.createFont();
        font.setItalic(false);
//        font.setBold(true);
        secondTitleStyle.setFont(font);
        return secondTitleStyle;
    }

    public static CellStyle headerStyle(Workbook workbook){
        CellStyle headerStyle = workbook.createCellStyle();
        headerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
        headerStyle.setAlignment(HorizontalAlignment.CENTER);
        headerStyle.setWrapText(true);
        headerStyle.setBorderTop(BorderStyle.THIN);
        headerStyle.setBorderRight(BorderStyle.THIN);
        headerStyle.setBorderLeft(BorderStyle.THIN);
        headerStyle.setBorderBottom(BorderStyle.THIN);
        Font font = workbook.createFont();
        font.setItalic(false);
        font.setBold(true);
        headerStyle.setFont(font);
        return headerStyle;
    }

    public static CellStyle commonStyle(Workbook workbook){
        CellStyle commonStyle = workbook.createCellStyle();
        commonStyle.setVerticalAlignment(VerticalAlignment.CENTER);
        commonStyle.setAlignment(HorizontalAlignment.CENTER);
        commonStyle.setWrapText(true);
        commonStyle.setBorderTop(BorderStyle.THIN);
        commonStyle.setBorderRight(BorderStyle.THIN);
        commonStyle.setBorderLeft(BorderStyle.THIN);
        commonStyle.setBorderBottom(BorderStyle.THIN);
        return commonStyle;
    }
}
